<?php

namespace IDock\Insurance\DAJIA\Response;

use IDock\Http\Response;
use IDock\Insurance\DAJIA\Response\AllDAJIAResponse;
use IDock\Printer\UploadFilePrinter;

class UploadFileResponse extends AllDAJIAResponse
{

    public function printerInit(): Response
    {
        $uploadFilePrinter = new UploadFilePrinter();

        $this->printer = $uploadFilePrinter;

        $data = $this->get('body',[]);
        if(!in_array($data['status'],['0000','0001'])){
            $this->setError($data['message']);
            throw new \Exception($data['message']);
        }

        return $this;
    }
}
